// components/Navigation/index.js
Component({
  /**
   * 组件的初始数据
   */
  data: {
    navList: [
      {id: 1, name: "首页", image:"../../static/photos/首页.png",path: "/pages/index/index"},
      {id: 2, name: "监测",  image:"../../static/photos/扫描 (2).png",path: "/pages/monitor/monitor"},
      {id: 3, name: "我的", image:"../../static/photos/我的.png",path: "/pages/mine/mine"},
      // {id: 4, name: "我的", image:"../../static/我的.png",path: "/pages/clock/clock"}

    ],
    
  },
  properties: {
    navId: {
      type: Number,
      value: 1
    }
  },
  ready(){
    this.initialHeight();
  },
  /**
   * 组件的方法列表
   */
  methods: {
    // 获取底部安全距离
    initialHeight(){
      const sysInfo = wx.getSystemInfoSync();
      this.setData({
        emptyHeight: sysInfo.windowHeight - sysInfo.safeArea.bottom
      })
    },
    jump2Event(e){
      const data = e.currentTarget.dataset,
            currentNav = this.data.navList.filter(item => item.id == data.id)[0];
      if(currentNav['path']) {
        if(currentNav['id']==2){
          wx.navigateTo({
            url: currentNav['path'],
          })
        }else{
        wx.reLaunch({
          url: currentNav['path'],
        })
      }
      // if end
      }
    }
  },
  
  
})